<template>
	<view class="repairReportList_box box">
		<view class="repairReportList_container">
			<view class="repairReportList_title">
				<text>我的报修</text>
			</view>
			<view class="" v-for="(item,index) in repairReportList" class="repairReportList_item">
				<view class="repairReportList_item_left">

				</view>
				<view class="repairReportList_item_center">
					<view class="repairReportList_item_center_title">
						{{item.repairsName}}
					</view>
					<view class="repairReportList_item_center_desc">
						<view class="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width: 44%;">
							{{item.repairsInfo}}
						</view>
						|
						<view class="" style="flex: 1;margin-left: 8rpx;">
							{{item.repairsTime}}
						</view>
					</view>
					<view class="repairReportList_item_centeraddress">
						<u-icon name="map" color="#959595" size="16"></u-icon>
						{{item.dormitoryName}} 宿舍
					</view>
				</view>
				<view class="repairReportList_item_right">
					已处理 <uni-icons type="right" size="20"></uni-icons>
				</view>
			</view>
		</view>
		<view class="sureBtn" @click="gotoCreateRepairRequestForm">
			我要报事/保修
		</view>
	</view>
</template>

<script>
	import {
		findSRRecordBySchoolUserId
	} from "../../api/request.js"
	export default {
		data() {
			return {
				repairReportList: []
			};
		},
		onShow() {
			const that = this
			uni.getStorage({
				key: "userInfoId",
				success(res) {
					that.findSRRecordBySchoolUserIdMethod(res.data)
				}
			})
		},
		methods: {
			async findSRRecordBySchoolUserIdMethod(num) {
				this.repairReportList = []
				let res = await findSRRecordBySchoolUserId(num)
				console.log(res);
				res.data.map((item) => {
					this.repairReportList.push(item)
				})
			},
			gotoCreateRepairRequestForm() {
				uni.navigateTo({
					url: "/pages/createRepairRequestForm/createRepairRequestForm"
				})
			}
		}
	}
</script>

<style lang="scss">
	.repairReportList_box {
		padding-bottom: 100rpx;
	}

	.repairReportList_container {
		margin: auto;
		width: 90%;
	}

	.repairReportList_title {

		text {
			display: inline-block;
			border-bottom: 1px solid #275DE3;
			padding-bottom: 20rpx;
			font-size: 40rpx;
			font-weight: 500;
		}
	}

	.repairReportList_item {
		display: flex;
		justify-content: space-between;
		height: 210rpx;
		margin-top: 60rpx;
		box-shadow: 0rpx 0px 10px 0px #ccc;

		.repairReportList_item_left {
			width: 16rpx;
			height: 100%;
			background-color: #346DF0;
			border-top-left-radius: 30rpx;
			border-bottom-left-radius: 30rpx;
		}

		.repairReportList_item_center {
			flex: 1;
			height: 100%;
			display: flex;
			flex-direction: column;

			.repairReportList_item_center_title {
				margin-top: 30rpx;
				margin-left: 30rpx;
				margin-bottom: 20rpx;
				font-weight: 600;
			}

			.repairReportList_item_center_desc {
				margin-left: 30rpx;
				display: flex;
				flex-flow: nowrap;
				font-size: 24rpx;
			}

			.repairReportList_item_centeraddress {
				margin-top: 20rpx;
				margin-left: 30rpx;
				font-size: 24rpx;
				color: #989898;
				display: flex;
			}
		}
	}

	.repairReportList_item_right {
		line-height: 210rpx;
	}

	.sureBtn {
		position: fixed;
		bottom: 40rpx;
		left: 0;
		right: 0;
		margin: auto;
		width: 90%;
	}
</style>